Description:
DIH detects declarations that hide other visible declarations. These are:
Local variables or method parameters that shadow fields
of the containing class. As far as it is common practice
in constructors to use formal parameters with the same name as
class components, DIH detects situations where a class field is
explicitly accessed by using
self
reference and does not produce
a warning message in this case.
When the option Include inherited fields is set in the audit properties, DIH considers
not only fields declared by a class, but also all of the inherited ones.
class
methods declared in superclasses.
Incorrect:
Container = class
private
size:integer;
public
procedure copyFrom(c:Container);
end;
...
procedure Container.copyFrom(c:Container);
var size:integer;
begin
size := c.size;
...
end;
Correct:
Container = class
private
size:integer;
public
procedure copyFrom(c:Container);
end;
...
procedure Container.copyFrom(c:Container);
var newSize:integer;
begin
newSize := c.size;
...
end;
Incorrect:
Window = class
protected
style:integer;
public
class function Create(...):Window;
end;
Button = class(Window)
protected
style:integer;
public
class function Create(...):Button;
end;
Correct:
Window = class
protected
style:integer;
public
class function Create(...):Window;
end;
Button = class(Window)
protected
extendedStyle:integer;
public
class function CreateButton(...):Button;
end;
Refactoring: